<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="author" content="邵铭">
    <title></title>
    <style>
        * {
            box-sizing: border-box;
        }



        body {
            margin: 0;
            padding: 0;
        }



        .box {
            width: 900px;
            height: 450px;
            margin: auto;
            border: 1px solid;
            position: absolute;
        }



        ul {
            width: 900px;
            margin: 0;
            padding: 20px;
            list-style: none;
            display: flex;
            justify-content: space-around;
        }



         li {
            width: 140px;
            height: 140px;
            border: 1px solid;
            text-align: center;
            background-color: #ECEFEC;
        }
        h2 {
            text-align: center;
        }

       

        ul:nth-child(2) {
            margin-top: -10px;
        }

       li {
            width: 150px;
            height: 150px;
            border: 1px solid;
            background-color: white;
            /*position: absolute;*/
            /*top: -388px;*/
            /*margin-top: -5px;*/
             /*display: none;*/
        }


        li img {
            width: 150px;
            height: 150px;
           position: relative;
           top: -85px;
           left: -1px;
           border:5px solid #999;
           display: none;
        }
    </style>
</head>

<body>
    <div class="box">
        <h2>名车车标展示</h2>
     
            <ul>
                <li>
                    <h4>BMN <br>宝马汽车</h4>
                    <img src="./img/1.jpg" alt="">
                </li>
                <li>
                    <h4>BMN <br>宝马汽车</h4>
                    <img src="./img/2.jpg" alt="">
                </li>
                <li>
                    <h4>BMN <br>宝马汽车</h4>
                    <img src="./img/3.jpg" alt="">
                </li>
                <li>
                    <h4>BMN <br>宝马汽车</h4>
                    <img src="./img/4.jpg" alt="">
                </li>
                <li>
                    <h4>BMN <br>宝马汽车</h4>
                    <img src="./img/5.jpg" alt="">
                </li>
            </ul>
            <ul>
                <li>
                    <h4>BMN <br>宝马汽车</h4>
                    <img src="./img/6.jpg" alt="">
                </li>
                <li>
                    <h4>BMN <br>宝马汽车</h4>
                    <img src="./img/7.jpg" alt="">
                </li>
                <li>
                    <h4>BMN <br>宝马汽车</h4>
                    <img src="./img/8.jpg" alt="">
                </li>
                <li>
                    <h4>BMN <br>宝马汽车</h4>
                    <img src="./img/9.jpg" alt="">
                </li>
                <li>
                    <h4>BMN <br>宝马汽车</h4>
                    <img src="./img/10.jpg" alt="">
                </li>
            </ul>
  
    </div>
   
</body>

</html>
<script>
    var lis=document.querySelectorAll('li');
    var imgs=document.querySelectorAll('img');
    for(var i=0;i<lis.length;i++){
        lis[i].index=i;
        imgs[i].index=i;
        lis[i].onmouseover=function(){
            imgs[this.index].style.display='block';
        }
        lis[i].onmouseout=function(){
             imgs[this.index].style.display='none';
        }
    }

</script>